#!/bin/bash
# Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.

set -euo pipefail
exploded=$1
staple=$2
if [ "$staple" = 'true' ]; then
  # only unzipped application can be stapled
  app="$exploded/$(ls "$exploded")"
  echo "Stapling $app..."
  xcrun stapler staple "$app"
else
  echo "Stapling of $exploded is skipped"
fi
